<?php

namespace App\Http\Model;

use Illuminate\Database\Eloquent\Model;

class Goods extends Model
{
    
    //此模型关联的数据表
    protected $table = 'sad_goods';

    //    表的主键
    public $primaryKey = 'id';
    //不更新created_at  updated_at字段
    public $timestamps = false;
    public $guarded = [];

    // 对前台用户列表一对多
    // 此表为副表1
    public function home_user()
    {
        return $this->belongsTo('App\Http\Model\Home_user','uid','id');
    }


    // 对商品板块列表一对多
    // 副表2
    public function type()
    {
        return $this->belongsTo('App\Http\Model\Type','tid','id');
    }


     public function goods()
    {
         return $this->hasMany('App\Http\Model\Order','gid','id');
    }
    
    // 对商品板块列表一对多
    // 副表2
    public function order()
    {
        return $this->hasOne('App\Http\Model\Order','gid');
    }


}
